<?php
define ( 'BASE_ROOT_PATH', dirname ( dirname ( __FILE__ ) ) );
include_once (BASE_ROOT_PATH . "/word/db/DBMySQL.php");
$memberId = $_REQUEST ['memberId'];
$tagId = $_REQUEST['tagId'];
$title = $_REQUEST ['title'];
$content = $_REQUEST ['content'];
$is_anonymous = $_REQUEST ['is_anonymous'];
$timestamp = time ();
$db = new DBMySQL();
$query = "INSERT INTO question(member_id, title, content, is_anonymous, timestamp) VALUES($memberId, '$title', '$content', $is_anonymous, '$timestamp')";
$questionId = $db->Insert($query);
$query = "INSERT INTO question_in_tag(question_id, tag_id) VALUES($questionId, $tagId)";
$db->Insert($query);
if(!empty($questionId)) { // 添加成功
	// 添加会员信息表记录
	echo '{"code":"0","msg":"'.$questionId.'"}';
}
else {
	echo '{"code":"1","msg":"提交问题失败"}';
	
}
?>